package com.example.noval.ui.adapter

import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager
import androidx.lifecycle.Lifecycle
import androidx.recyclerview.widget.RecyclerView
import androidx.viewpager2.adapter.FragmentStateAdapter

/**
 * @Description
 * @Author zzl
 * @Date 2024/3/13
 */
class ViewPager2Adapter(
    fragmentManager:FragmentManager,
    lifecycle:Lifecycle,
    private val fragments:List<Fragment>): FragmentStateAdapter(fragmentManager,lifecycle){

    override fun getItemCount(): Int {
    
        return fragments.size

    }

    override fun createFragment(position: Int): Fragment {
        
        return fragments[position]
    }
}